unit u_Principal;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, dxCore, dxButton, ExtCtrls, MMJPanel, jpeg, RXCtrls, Menus,
  UCBase, ActnList;

type
  Tf_Principal = class(TForm)
    MMJPanel1: TMMJPanel;
    dxButton1: TdxButton;
    dxButton2: TdxButton;
    img1: TImage;
    dxButton3: TdxButton;
    RxLabel11: TRxLabel;
    mm1: TMainMenu;
    Cadastro1: TMenuItem;
    Movimentao1: TMenuItem;
    EntradadeFruta2: TMenuItem;
    SaidadeProdutos2: TMenuItem;
    CaddeTransportadoras1: TMenuItem;
    Usuarios1: TMenuItem;
    Cadastro2: TMenuItem;
    rocarSenha1: TMenuItem;
    Logoof1: TMenuItem;
    UserControl1: TUserControl;
    AnalizedeFruta1: TMenuItem;
    EntradadeProdutos1: TMenuItem;
    N1: TMenuItem;
    dxButton4: TdxButton;
    dxButton5: TdxButton;
    actlstFinanceiro: TActionList;
    actfruta: TAction;
    actbagaco: TAction;
    actlenha: TAction;
    acttransportadora: TAction;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure dxButton2Click(Sender: TObject);
    procedure SaidadeProdutos2Click(Sender: TObject);
    procedure CaddeTransportadoras1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure AnalizedeFruta1Click(Sender: TObject);
    procedure EntradadeProdutos1Click(Sender: TObject);
    procedure EntradadeFruta2Click(Sender: TObject);
    procedure actfrutaExecute(Sender: TObject);
    procedure actbagacoExecute(Sender: TObject);
    procedure actlenhaExecute(Sender: TObject);
    procedure acttransportadoraExecute(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  f_Principal: Tf_Principal;

implementation

uses u_Pesagem, UDM, uftransp, u_PesoSaida, u_Busca, u_PesoEntrada;

{$R *.dfm}

procedure Tf_Principal.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  if MessageDlg('Voce realmente deseja encerrar o sistema ?',mtConfirmation, [mbYes,mbNo],0) = mrYes then
     Application.Terminate
  else
    abort;
end;

procedure Tf_Principal.dxButton2Click(Sender: TObject);
begin
  Close;
end;

procedure Tf_Principal.SaidadeProdutos2Click(Sender: TObject);
begin
 usulog :=  f_Principal.UserControl1.CurrentUser.UserID;
 nome_user := f_Principal.UserControl1.CurrentUser.UserName;
 f_PesoSaida.ShowModal;
end;

procedure Tf_Principal.CaddeTransportadoras1Click(Sender: TObject);
begin
 ftransp := Tftransp.Create(Application);
 try
   ftransp.ShowModal;
 finally
   ftransp.Free;
 end;
end;

procedure Tf_Principal.FormShow(Sender: TObject);
begin
  UserControl1.AutoStart := True;
  UserControl1.Execute;

  usulog :=  f_Principal.UserControl1.CurrentUser.UserID;
  nome_user := f_Principal.UserControl1.CurrentUser.UserName;
end;

procedure Tf_Principal.AnalizedeFruta1Click(Sender: TObject);
begin
  usulog :=  f_Principal.UserControl1.CurrentUser.UserID;
  nome_user := f_Principal.UserControl1.CurrentUser.UserName;
  DM.id_NTC := 0;
  DM.TELA := 'PRINCIPAL';
  f_Busca.v_ChamadoPor := 'ANALISE';
  f_Busca.dxButton2.Enabled := True;
  f_Busca.ShowModal;
end;

procedure Tf_Principal.EntradadeProdutos1Click(Sender: TObject);
begin
 usulog :=  f_Principal.UserControl1.CurrentUser.UserID;
 nome_user := f_Principal.UserControl1.CurrentUser.UserName;
 f_PesoEntrada.ShowModal;
end;

procedure Tf_Principal.EntradadeFruta2Click(Sender: TObject);
begin
 usulog :=  f_Principal.UserControl1.CurrentUser.UserID;
 nome_user := f_Principal.UserControl1.CurrentUser.UserName;
 f_Pesagem.ShowModal;
end;

procedure Tf_Principal.actfrutaExecute(Sender: TObject);
begin
 usulog :=  f_Principal.UserControl1.CurrentUser.UserID;
 nome_user := f_Principal.UserControl1.CurrentUser.UserName;
 f_Pesagem.ShowModal;
end;

procedure Tf_Principal.actbagacoExecute(Sender: TObject);
begin
 usulog :=  f_Principal.UserControl1.CurrentUser.UserID;
 nome_user := f_Principal.UserControl1.CurrentUser.UserName;
 f_PesoSaida.ShowModal;
end;

procedure Tf_Principal.actlenhaExecute(Sender: TObject);
begin
 usulog :=  f_Principal.UserControl1.CurrentUser.UserID;
 nome_user := f_Principal.UserControl1.CurrentUser.UserName;
 f_PesoEntrada.ShowModal;
end;

procedure Tf_Principal.acttransportadoraExecute(Sender: TObject);
begin
 ftransp := Tftransp.Create(Application);
 try
   ftransp.ShowModal;
 finally
   ftransp.Free;
 end;
end;

end.
